"""

64894ce562ff15cee53e60ec337a68fc3518de89bf05fffa13c0bdf294634c8d


"""
import execjs
import requests

with open("yibao.js", "r", encoding="utf-8") as fp:
    js = fp.read()

ctx = execjs.compile(js)

headers = ctx.call("getHeaders")
headers["user-agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"

data = {
    "addr": "",
    "medinsLvCode": "",
    "medinsName": "",
    "medinsTypeCode": "",
    "outMedOpenFlag": "",
    "pageNum": 1,
    "pageSize": 10,
    "queryDataSource": "es",
    "regnCode": "430100"
}

params = ctx.call("get_encrypt", data)
# print(params, type(params))
url = "https://fuwu.nhsa.gov.cn/ebus/fuwu/api/nthl/api/CommQuery/queryFixedHospital"

decrypt_data = requests.post(url, headers=headers, json=params).json()
print(decrypt_data)
res = ctx.call("get_decrypt", decrypt_data)
print(res)